package day03;
import java.io.BufferedReader;
//服务器
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Date;
import java.util.Scanner;

public class ServerA {

	public static void main(String[] args) throws IOException {
		//ip就是本机IP 给服务器指定一个端口号
		ServerSocket ss=new ServerSocket(8000);
		//等待客户端连接，如果没有客户端连接，程序进入阻塞状态
		while(true) {
			Socket s=ss.accept();
			//当前系统时间发送给客户端
			PrintWriter pw=new PrintWriter(s.getOutputStream(),true);
			Scanner sc=new Scanner(System.in);
			pw.println(new Date());
			BufferedReader br =new BufferedReader(new InputStreamReader(s.getInputStream()));
			String m=br.readLine();
			System.out.println("成了成了成了");
			System.out.println(m);	

			
		
		}
	}

}
